//
//  WIFIManager.m
//  gdemm
//
//  Created by 乔明超 on 16/6/23.
//  Copyright © 2016年 Goldencis. All rights reserved.
//

#import "WIFIManager.h"

@implementation WIFIManager
+ (NSString *)getWIFISSID{
    NSString *wifiSSID = nil;
    CFArrayRef wifiInterfaces = CNCopySupportedInterfaces();
    if (!wifiInterfaces) {
        return nil;
    }
    
    NSArray *interfaces = (__bridge NSArray *)(wifiInterfaces);
    for (NSString *interfaceName in interfaces) {
        CFDictionaryRef dicRef = CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName);
        if (dicRef) {
            NSDictionary *netWorkInfo = (__bridge NSDictionary *)(dicRef);
            wifiSSID = [netWorkInfo objectForKey:(__bridge NSString *)kCNNetworkInfoKeySSID];
            CFRelease(dicRef);
        }
    }
    CFRelease(wifiInterfaces);
    return wifiSSID;
}
@end
